package org.example.blogserver.controller;

import org.example.blogserver.service.ArticleService;
import org.example.blogserver.vo.Result;
import org.example.blogserver.vo.params.ArticleIdParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@CrossOrigin
@RequestMapping("note-center")public class NoteCenterController {
    @Autowired
    private ArticleService articleService;
    @PostMapping("/view")
    public Result findArticlesByAuthorAccount(@RequestParam String account){
        return articleService.findArticlesByAuthorAccount(account);
    }
    @PostMapping("/delete")
    public Result deleteArticleById( @RequestHeader String token, @RequestBody ArticleIdParam articleIdParam){
        return articleService.deleteArticleById(token,articleIdParam.getId());
    }
}
